package main

import (
	"fmt"
	"sync"
	"time"
)

var wg sync.WaitGroup

func f() {
	for i := 0; i < 10; i++ {
		fmt.Println("f方法", i)
		time.Sleep(time.Millisecond * 500)
	}
	wg.Done()

}

func d() {
	for i := 0; i < 10; i++ {
		fmt.Println("d方法", i)
		time.Sleep(time.Millisecond * 50)
	}
	wg.Done()
}

func main() {

	wg.Add(1)
	go f()
	wg.Add(1)
	go d()
	wg.Wait()
}
